android: Enable building ashmem and binder as modules
authorBen Hutchings <ben@decadent.org.uk>
Fri, 22 Jun 2018 16:27:00 +0000 (17:27 +0100)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 15 May 2019 22:07:16 +0000 (23:07 +0100)
We want to enable use of the Android ashmem and binder drivers to
support Anbox, but they should not be built-in as that would waste
resources and increase security attack surface on systems that don't
need them.

- Add a MODULE_LICENSE declaration to ashmem
- Change the Makefiles to build each driver as an object with the
  "_linux" suffix (which is what Anbox expects)
- Change config symbol types to tristate

Gbp-Pq: Topic debian
Gbp-Pq: Name android-enable-building-ashmem-and-binder-as-modules.patch

drivers/android/Kconfig
drivers/android/Makefile
drivers/android/binder_alloc.c
drivers/staging/android/Kconfig
drivers/staging/android/Makefile
drivers/staging/android/ashmem.c

index 432e9ad7707032758b6025930dad941a5a735e21..5f054abd6a10e46f9f41471b3b94580aa87682ee 100644 (file)
@@ -9,7 +9,7 @@ config ANDROID
 if ANDROID
 
 config ANDROID_BINDER_IPC
-       bool "Android Binder IPC Driver"
+       tristate "Android Binder IPC Driver"
        depends on MMU
        default n
        ---help---
index a01254c43ee3f714020aff487314f32ec0b2bbde..e42257997ba8c4f2f69a51b0ea19c07d285e1f1f 100644 (file)
@@ -1,4 +1,5 @@
 ccflags-y += -I$(src)                  # needed for trace events
 
-obj-$(CONFIG_ANDROID_BINDER_IPC)       += binder.o binder_alloc.o
-obj-$(CONFIG_ANDROID_BINDER_IPC_SELFTEST) += binder_alloc_selftest.o
+obj-$(CONFIG_ANDROID_BINDER_IPC)       += binder_linux.o
+binder_linux-y := binder.o binder_alloc.o
+binder_linux-$(CONFIG_ANDROID_BINDER_IPC_SELFTEST) += binder_alloc_selftest.o
index 030c98f35cca73aaf5168f559e259e658b5d05ad..fc7280e91a0c1d23d13b21a56cbcc1a4f6e17911 100644 (file)
@@ -44,7 +44,7 @@ enum {
 };
 static uint32_t binder_alloc_debug_mask = BINDER_DEBUG_USER_ERROR;
 
-module_param_named(debug_mask, binder_alloc_debug_mask,
+module_param_named(alloc_debug_mask, binder_alloc_debug_mask,
                   uint, 0644);
 
 #define binder_alloc_debug(mask, x...) \
index 17c5587805f54eed328bf7b3246939c73735c620..c46669f32bfa40faddb0273669f951fb147aa51c 100644 (file)
@@ -3,7 +3,7 @@ menu "Android"
 if ANDROID
 
 config ASHMEM
-       bool "Enable the Anonymous Shared Memory Subsystem"
+       tristate "Enable the Anonymous Shared Memory Subsystem"
        default n
        depends on SHMEM
        help
index 90e6154f11a4cda073c5a6f69944d231361270be..8202002bd72cbec1d88a6b8bc4916e352d00da9c 100644 (file)
@@ -2,5 +2,6 @@ ccflags-y += -I$(src)                   # needed for trace events
 
 obj-y                                  += ion/
 
-obj-$(CONFIG_ASHMEM)                   += ashmem.o
+obj-$(CONFIG_ASHMEM)                   += ashmem_linux.o
+ashmem_linux-y += ashmem.o
 obj-$(CONFIG_ANDROID_VSOC)             += vsoc.o
index be815330ed9588b623ff5a88d22f107d4bf61fc3..4424336ab0188d6f9aa2c2ce063a9b899740ac6c 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/bitops.h>
 #include <linux/mutex.h>
 #include <linux/shmem_fs.h>
+#include <linux/module.h>
 #include "ashmem.h"
 
 #define ASHMEM_NAME_PREFIX "dev/ashmem/"
@@ -924,3 +925,5 @@ out:
        return ret;
 }
 device_initcall(ashmem_init);
+
+MODULE_LICENSE("GPL v2");